######
# See: https://hub.docker.com/_/php/
######

FROM php:7.2-fpm

#apt-get源 使用aliyun的源
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bakevan && \    
    echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list && \
    echo "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >>/etc/apt/sources.list 
RUN apt-get update && apt-get install -y \
      libfreetype6-dev \
      libjpeg62-turbo-dev \
      libpng-dev \
      libc-client-dev \
      libkrb5-dev \
      wget \
  && docker-php-ext-install -j$(nproc) iconv \
  && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
  && docker-php-ext-install -j$(nproc) gd \
  && docker-php-ext-install pdo_mysql \
  && pecl install redis \
  && docker-php-ext-enable redis \
  && docker-php-ext-install sockets \
  && docker-php-ext-enable sockets \
  && docker-php-ext-install pcntl \
  && docker-php-ext-enable pcntl \
  && docker-php-ext-install posix \
  && docker-php-ext-enable posix \
  && docker-php-ext-configure imap --with-kerberos --with-imap-ssl \
  && docker-php-ext-install imap \
  && docker-php-ext-configure opcache --enable-opcache \
  && docker-php-ext-install opcache
   
  # && pecl install swoole \
  # && docker-php-ext-enable swoole\
  # && pecl install xdebug \
  # && docker-php-ext-enable xdebug \
  # && docker-php-ext-install exif \
